<template>
  <van-nav-bar :title="title">
      <template #left>
        <van-dropdown-menu>
          <van-dropdown-item :options="option" @change="change">
            <template #title>
              <van-icon name="search" size="18" />
            </template>
          </van-dropdown-item>
        </van-dropdown-menu>
      </template>
    <template #right v-if="comRoute === '/user'">
      <div @click="$router.push({name:'admin'})">点击显示管理员界面</div>
      <van-icon name="search" size="18" />
    </template>
  </van-nav-bar>
</template>

<script>
import { mapState } from 'vuex'
export default {
  props: {
    title: {
      type: String,
      required: true
    }
  },
  data() {
    return {
      option: [
        { text: '我的信息', value: 0 },
        { text: '更改密码', value: 1 },
        { text: '退出', value: 2 },
      ],
      value:''
    }
  },
  computed: {
    ...mapState(['role']),
    comRoute() {
      return this.$route.path
    }
  },
  methods: {
    change(e) {
      console.log(e);
      
    }
  }
}
</script>

<style lang="less" scoped>
  ::v-deep .van-dropdown-menu__bar {
    box-shadow: none;
  }
  ::v-deep .van-nav-bar__left::after{
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    position: absolute;
    right: 11px;
    background: #fff;
    z-index: 999;
  }
</style>